<template>
 <h1>一个人的信息</h1>
 <h2>姓名：{{ name }}</h2>
 <h2>年龄:{{ age }}</h2>
 <h2>工作种类:{{ job.type }}</h2>
 <h2>工作薪资:{{ job.salary }}+{{ job.a.kkk }}</h2>
 <button @click="sayHello">说话</button>
 <br><br>
 <button @click="changeInfo">修改人的信息</button>
</template>

<script>
import {ref,reactive} from 'vue'
export default {
  name: 'App',
  setup(){
    //数据
    let name=ref("张三")
    let age=ref(18)
    let job=ref({
      type:'前端工程师',
      salary:'30k',
      a:{
        kkk:'yyyy',
      }
    })
    let car=reactive({
      car_name:"奔驰",
      price:99999
    })

    //方法
    function sayHello(){
      alert(`我叫${name},我今年${age}岁了，你好呀！`)
    }
    function changeInfo(){
      // name="李四"
      // age=48;

      // name.value="李四"
      // age.value=48
      // console.log(name,age);//基本数据refImpl

      job.value.type="UI设计师"
      job.value.salary="40K"
      job.value.a.kkk="sdjsdjsdjs"
      console.log(job);//对象类型数据refImpl
      console.log(car);
    }

    return{
      name,age,sayHello,changeInfo,job
    }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
